<?php

class CompleteWebTestCase extends CakeWebTestCase {
    function CompleteWebTestCase() {
        $base = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
        $this->baseurl = current(explode("/app/webroot", $base));        
    }

    function testLoginEmpty() {
        $this->get($this->baseurl . '/people/login');
        $this->assertField('data[Person][username]', '');
        $this->assertField('data[Person][password]', '');
    }
    
    function testLoginFail() {
        $this->get($this->baseurl . '/people/login');
        
        $this->setField('data[Person][username]', 'bad');
        $this->setField('data[Person][password]', 'bad');
        $this->click('Login');
        
        $this->assertText('Incorrect');
    }
    
    function testLoginGood() {
        $this->get($this->baseurl . '/people/login');
        
        $this->setField('data[Person][username]', 'user1');
        $this->setField('data[Person][password]', 'pass1');
        $this->click('Login');
        $this->assertNoText('Incorrect');    
    }
    
    function testClickEvent() {
        $this->testLoginGood();
        $this->click("Empty 1");
        $this->assertTitle("Simple Family Photos - Events");
    }
}

?>
